<?php

class AppController extends Controller {
	public $components = array('DebugKit.Toolbar','Session',
			'Auth' => array(
				'authenticate' => array('Form' => array( 'fields'=>array('username'=>'user_name'), 'userModel' => 'User', 'scope'=>array('User.is_active' => true))),
		        'loginAction' => array(
		            'controller' => 'users',
		            'action' => 'login'
		        ),
				'loginRedirect'=>'/home/index',
				'authorize'=>array('Controller')
    		)
	);
	public $helpers = array('Js' => array('Jquery'), 'Html', 'Form', 'Session');
	
	function isAuthorized($user) {
        if (isset($this->request->params['admin'])) {
            return ($user['is_admin'] == '1');
        }
        return true;
    }
	
}